<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="renderer" content="webkit">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=no">
    <meta name="format-detection" content="telphone=no, email=no"/>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<title>环保数据管家</title>
	<link rel="stylesheet" type="text/css" href="assets/css/reset.css">
	<link rel="stylesheet" type="text/css" href="assets/css/iconfont/iconfont.css">
	<link rel="stylesheet" type="text/css" href="assets/css/app.css">
    <link rel="stylesheet" type="text/css" href="assets/css/map.css">
    <style type="text/css">
	.zhibiao-legend .zb-item {
	    background-color:#FFF!important;
	}
    .zhibiao-legend .disable{
        background-color: #efefef !important;
		border-color: #cccccc !important;
		color:#666666 !important;
    }
	.highcharts-legend {display:none;}
	body {max-width:100%;}
	.order-hd-title a {text-decoration:none;color:#333333;}
	.aqi-tables tbody td.date small {line-height:normal;}
	#month-select,.month-select{outline: none;border: 1px solid #23AE39;border-radius: 0.15rem;background: none;font-size: 0.4rem;line-height: 0.4rem;}
	.order-bd tfoot td{
		font-size: 0.5rem;
		text-align: left;
		color: #666666;
	}
	i.targetNum{color: #666666!important;font-size:0.5rem!important;}
	#sorttable tr td{
		font-size: 0.6rem;
	}
    .aqi-map{
        position: relative;
        width: 100%;
        height: 20rem;
        background-color: #F9F9F9;
        margin-bottom: 2rem;
    }
    #chart-1{
        padding-left:30px;
    }
    #chart-1 svg{
        margin: 0 auto;
    }
    #chart-1-title{
       font-size:0.6rem;
       color: #9a9a9a;
       line-height: 1.2rem;
       margin-top: 32%;
    }
    .higcolor{
        color:#41B551;
        /*font-size: 0.7rem;                 */
    }
    .equcolor{
        color:#2771B2;
        /*font-size: 0.7rem;  */
    }
    .lowcolor{
        color:#ff6000;
        font-size: 0.8rem;  
    }
	</style>
    <script type="text/javascript">
		/**
   * 对Date的扩展，将 Date 转化为指定格式的String
   * 月(M)、日(d)、12小时(h)、24小时(H)、分(m)、秒(s)、周(E)、季度(q) 可以用 1-2 个占位符
   * 年(y)可以用 1-4 个占位符，毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
   * eg:
   * (new Date()).pattern("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
   * (new Date()).pattern("yyyy-MM-dd E HH:mm:ss") ==> 2009-03-10 二 20:09:04
   * (new Date()).pattern("yyyy-MM-dd EE hh:mm:ss") ==> 2009-03-10 周二 08:09:04
   * (new Date()).pattern("yyyy-MM-dd EEE hh:mm:ss") ==> 2009-03-10 星期二 08:09:04
   * (new Date()).pattern("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
   */
  Date.prototype.pattern = function(fmt) {
    var o = {
      "M+": this.getMonth() + 1, //月份
      "d+": this.getDate(), //日
      "h+": this.getHours() % 12 == 0 ? 12 : this.getHours() % 12, //小时
      "H+": this.getHours(), //小时
      "m+": this.getMinutes(), //分
      "s+": this.getSeconds(), //秒
      "q+": Math.floor((this.getMonth() + 3) / 3), //季度
      "S": this.getMilliseconds() //毫秒
    };
    var week = {
      "0": "\u65e5",
      "1": "\u4e00",
      "2": "\u4e8c",
      "3": "\u4e09",
      "4": "\u56db",
      "5": "\u4e94",
      "6": "\u516d"
    };
    if (/(y+)/.test(fmt)) {
      fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    }
    if (/(E+)/.test(fmt)) {
      fmt = fmt.replace(RegExp.$1, ((RegExp.$1.length > 1) ? (RegExp.$1.length > 2 ? "星期" : "") : "") + week[this.getDay() + ""]);
    }
    for (var k in o) {
      if (new RegExp("(" + k + ")").test(fmt)) {
        fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
      }
    }
    return fmt;
  }
	</script>
</head>
<body>
    <div class="pf-content wuranwu-wrap">
      <div class="title_box">
        <h1 class="h_tit">空气质量优良率</h1>
        <div class="order-hd-select">
          <select class="month-select everymonth-select" id="ylv-month-select"></select>
        </div>
      </div>
      <div class="wr-chat">
        <div class="left-chart">
          <div id="chart-1"></div>
        </div>
        <div class="right-info">
          <div id="chart-1-title"></div>
        </div>
      </div>
      <div class="title_box">
        <h1 class="h_tit">各区PM2.5浓度</h1>
        <div class="order-hd-select">
          <select class="month-select" id="month-select"></select>
        </div>
      </div>
      <div class="wr-chat order-bd">
          <table>
            <thead class="thead">
              <tr class="firstRow">
                <td rowspan="2" colspan="1">区域</td>
                <td valign="top" rowspan="1" colspan="4">PM2.5（μg/m3）</td>
              </tr>
              <tr id="order-month-warp">
                <td>2016年4月</td>
                <td>环比</td>
                <td>同比</td>
                <td>较2013年全年(目标)</td>
              </tr>
            </thead>
            <tbody id="sorttable"></tbody>
          </table>  
      </div>
    </div>
</body>
<script src="assets/js/jquery.js"></script>
<script src="assets/js/touch.min.js"></script>
<script src="assets/echart/echarts.js"></script>
<!-- <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=EO5oHjEfgBz7QieWfqG08jcx"></script>
<script type="text/javascript" src="http://api.map.baidu.com/getscript?v=2.0&ak=EO5oHjEfgBz7QieWfqG08jcx&services=&t=20160310104956"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/Heatmap/2.0/src/Heatmap_min.js"></script>
<script src="assets/maps/geocoordmap.js"></script>
<script src="assets/maps/mapstyle.js"></script> -->
<script>
	touch.on('#app-back', 'tap', function(ev){
	  location.href='index.html';
	});
	touch.on('#app-main-link', 'tap', function(ev){
	  location.href='index.html';
	});
  touch.on('#app-middle-link', 'tap', function(ev){
	  location.href='air-quality.html';
	});
	touch.on('#app-map-link', 'tap', function(ev){
	  location.href='map.html';
	});
	touch.on('#redline', 'tap', function(ev){
	  location.href='redline-map.html';
	});
	function getJSONData(url,callback){
      $.ajax({
          type: "get",
          contentType: "application/json; charset=utf-8",
          dataType: "json",
          url: url,  //这里是网址
          success: function (json) {
              callback(json)
          },
          timeout: 90*1000,
          error: function (XMLHttpRequest, textStatus, errorThrown) {
              console.error(url,textStatus+": "+errorThrown);
          }
      });
  }
  function RMS(s){
  	return s.replace('市','');//.replace('特别行政区','');
  }
	</script>
	<script>
  var host='http://58.213.141.220:8989/njhbindex';
  
  //生成12个月的下拉
	var currentMonth = (new Date()).pattern("M")-1,
	    currentYear = (new Date()).pattern("yyyy"),
      currentDay=(new Date()).pattern("dd");
  if(currentMonth==0){
		currentMonth=12;
		currentYear-=1;
	}
	currentMonth=currentMonth<10?'0'+currentMonth:currentMonth;
    var monthArray = function (cy,cm) {
        var result = [];
        for(var y=cy;y>2015;y--){
            if(cy==y){
                for(;cm>=1;cm--){
                    result.push(y+'-'+paddingZero(cm));
                }
            }else{
                for(var m=12;m>=1;m--){
                    result.push(y+'-'+paddingZero(m));
                }
            }
        }
        return result;
    }
    function paddingZero(m){
        if(m.length>1) return m;
        return m < 10 ? "0" + m : m;
    }
     
	var tmpselect=''; 
    monthArray(currentYear,currentMonth).forEach(function(e,v){
        tmpselect+='<option value="'+e+'">'+e.replace(/-/g,'年')+'月</option>';
	});
	$('#ylv-month-select').html(tmpselect);
    tmpselect+='<option value="2015-12">2015年</option>';
    $('#month-select').html(tmpselect);
	// 月份切换
    $('#ylv-month-select').change(function(){
	    setYlvChart($(this).val());
    });
    // 月份切换
    $('#month-select').change(function(){
	    setSortTable($(this).val());
    });
    
    var areas={
			1:["南京开发区","2008","仙林大学城",-13,1],
			2:["栖霞区","2008,2007","仙林大学城,迈皋桥",-13,2],
			3:["建邺区","2009","奥体中心",-13,3],
			4:["高新开发区","2010","浦口",-13,4],
			5:["浦口区","2010","浦口",-13,5],
			6:["玄武区","2004","玄武湖",-13,6],
			7:["鼓楼区","2001,2006","草场门，山西路",-13,7],
			8:["秦淮区","2003","瑞金路",-13,8],
			9:["六合区","2022","雄州",-4,9],
			10:["江宁开发区","2018","将军大道",-13,10],
			11:["雨花台区","2002","中华门",-13,11],
			12:["南京化工园","2011","化工园",-13,12],
			13:["高淳区","2013","淳溪",-2,13],
			14:["江宁区","2016","彩虹桥",-4,14],
			15:["溧水区","2024","永阳",-2,15],
			16:["全市","2000","全市",-13,16]
		},areas2014={
			9:'*',
			13:'*',
			14:'*',
			15:'*',
		};
	getJSONData(host+'/data?act=areainfo',function(data){
		var trs=[];
		if(data.Error==null){
			//重新排列
			var tmpData = [];
			tmpData[0] = data.Data[5];
			tmpData[1] = data.Data[7];
			tmpData[2] = data.Data[2];
			tmpData[3] = data.Data[6];
			tmpData[4] = data.Data[1];
			tmpData[5] = data.Data[10];
			tmpData[6] = data.Data[4];
			tmpData[7] = data.Data[13];
			tmpData[8] = data.Data[8];
			tmpData[9] = data.Data[14];
			tmpData[10] = data.Data[12];
			tmpData[11] = data.Data[9];
			tmpData[12] = data.Data[0];
			tmpData[13] = data.Data[3];
			tmpData[14] = data.Data[11];
			tmpData[15] = data.Data[15];
			data.Data = tmpData;
			data.Data.forEach(function(e,i){
				areas[e.id][0]=e.name;
				areas[e.id][1]=e.codes;
				areas[e.id][2]=e.areas;
				areas[e.id][3]=e.target;
				areas[e.id][4]=e.index;
				trs.push('<tr id="st-'+e.id+'"><td>'+e.name+(areas2014[e.id]!=undefined?'*':'')+'</td><td></td><td></td><td></td><td></td></tr>');
			});
		}
		$('#sorttable').html(trs.join(''));
    var _currentYear=currentYear,
        _currentMonth=currentMonth;
    // if(currentDay<15) _currentMonth-=1;
    if(_currentMonth==0){
      _currentMonth=12;
      _currentYear-=1;
    }else if(_currentMonth==-1){
      _currentMonth=11;
      _currentYear-=1;
    }
		setSortTable(_currentYear+'-'+paddingZero(_currentMonth));
	});
	function setSortTable(month){
    $('#month-select').val(month);
		var qstr=month.split('-');
		var curmstr=qstr[0]+'/'+qstr[1];
		$('#order-month-warp').find('td').eq(0).html(curmstr);
		getJSONData(host+'/data?act=areamonth&month='+month,function(data){
			if(data.Error==null){
				data.Data.forEach(function(e){
					var tds=$('#st-'+e.areaid).find('td')
						,g1=getGrowth(e.value,e.hbrate)
						,g2=getGrowth(e.value,e.tbrate);
					tds.eq(1).html(e.value);
					tds.eq(2).html(g1+'%').css('color',g1<0?'#09c900':'#ff6000');
					tds.eq(3).html(g2+'%').css('color',g2<0?'#09c900':'#ff6000');
				});
			}
		});
		getJSONData(host+'/data?act=areayear&year='+qstr[0],function(data){
			if(data.Error==null){
				data.Data.forEach(function(e){
					var pm25,jzpm25,id=e.areaid;
					if(parseInt(qstr[0])==2016){
						if(e.monthtype==200+parseInt(qstr[1])){
							pm25=e.pm25;
							jzpm25=e.jzpm25;
						}else if(e.monthtype==200+parseInt(qstr[1])-1){
              pm25=e.pm25;
              jzpm25=e.jzpm25;
            }
					}else{
						pm25=e.pm25;
						jzpm25=e.jzpm25;
					}
					if(pm25!=undefined&&jzpm25!=undefined){
						var g3=getGrowth(pm25,jzpm25);
						$('#st-'+id).find('td').eq(4).html(g3+'%<i class="targetNum">('+areas[id][3]+'%)</i>').css('color',g3<areas[id][3]?'#09c900':'#ff6000');
					}
				});
			}
		});
	}
    function getGrowth(v1,v2){
		if(v1==''||v2=='') return '';
		return (((v1-v2)/v2)*100).toFixed(2);
	}
  
  var __gauge;
  var c1={
        borderColor:'#CBE7F5',
        innerBorderColor:'#D1E9F6',
        arrowColor:'#00A8E0',
        startColor:'#00A8E0',
        endColor:'#72CD2C',
        waveColor:'#72CD2C',
        minValue: 0,
        maxValue: 150,
        img:{
            width:28,
            height:50,
            src:'assets/img/ylvicon.png'
        },
        title:'空气质量优良率'
    };
var c2={
    borderColor:'#F5E7E4',
    innerBorderColor:'#FDD0BB',
    arrowColor:'#E85800',
    startColor:'#E85800',
    endColor:'#F48C70',
    waveColor:'#E85800',
    minValue: 0,
    maxValue: 150,
    img:{
        width:28,
        height:50,
        src:'assets/img/ylvicon.png'
    },
    title:'优良天数'
}
function setYlvChart(month){
    $('#ylv-month-select').val(month);
    var qstr=month.split('-');
    getJSONData(host+'/data?act=areayear&year='+qstr[0],function(data){
        if(data.Error==null){
        	var okStatus = false;
            data.Data.forEach(function(e){
                var yldays,jzyldays,id=e.areaid;
                if(id==16){
                    if(parseInt(qstr[0])==2016){
                        if(e.monthtype==200+parseInt(qstr[1])){
                            yldays=e.yldays;
                            jzyldays=e.jzyldays;
                        }
                    }else{
                        yldays=e.yldays;
                        jzyldays=e.jzyldays;
                    }
                    if(yldays!=undefined&&jzyldays!=undefined){
                    	okStatus = true;
                        var year=qstr[0],m1=year%4==0?29:28,m2=(year-1)%4==0?29:28;
                        var days=getDaysInYear(qstr[0],parseInt(qstr[1],10));
                        var g=yldays/days,g2=jzyldays/(days+m2-m1),v=getGrowth(yldays,jzyldays),v=g-g2,c=v>=0?c1:c2,vt=(Math.abs(v).toFixed(3)*100)+' 个百分点',t=v>0?'<span class="higcolor">增长'+vt+'</span>':(v==0?'<span class="equcolor">持平</span>':'<span class="lowcolor">降低'+vt+'</span>');
                        // (较2015年同期优良天数，完成率为'+g+'%)<br/>
                        var __m=qstr[1]-1+1;
                        // c.title=''+qstr[0]+'年'+(__m>1?'1——'+__m:__m)+'月,全市建成区空气质量达到国家二级标准天数 <b>'+yldays+'</b> 天,达标率为 <b>'+(g*100).toFixed(1)+'%，同比上年'+t;
                        // console.log(g,g2);
                        c.title='优良天数 <span class="days">'+yldays+'</span> 天 '+'<br/>去年同期 <span class="old_year">'+jzyldays+'</span> 天 <br/>优良率较去年同期<br/>'+t;

                        var chart1=new __gauge('#chart-1',0, c);
                        chart1.update(g*100);
                        $('#chart-1-title').html(c.title);
                    }
                }
            });
        	//无数据的情况去取上一个月的数据
            if(!okStatus){
            	var idx = $("option:selected", "#ylv-month-select").index()
            	,len = $("option", "#ylv-month-select").length;
            	if((idx+1)<=(len-1) && len>1){
            		//轮询防止异步冲突
            		var tmpTimeOutQuery = function(){
    					var val = $("option:eq("+(idx+1)+")", "#ylv-month-select").val();
						setYlvChart(val);
            			var svg = $("svg", "#chart-1");
            			if(svg && svg.length>0){
            				//do nothing end.
            			}else{
							setTimeout(tmpTimeOutQuery, 1);
            			}
            		}
    				setTimeout(tmpTimeOutQuery, 1);
            	}
            }
        }
    });
}
function getDaysInYear(year,month){
    var i=1,l=month;
    var days=0;
    for(;i<=l;i++){
        days+=getDaysInMonth(year,i);
    }
    return days;
}
function getDaysInMonth(year,month){ 
    month = parseInt(month,10);
    var temp = new Date(year,month,0); 
    return temp.getDate(); 
}
  var myChart,__type=0;
  var AllCitys=["海门","鄂尔多斯","招远","舟山","齐齐哈尔","盐城","赤峰","青岛","乳山","金昌","泉州","莱西","日照","胶南","南通","拉萨","云浮","梅州","文登","上海","攀枝花","威海","承德","厦门","汕尾","潮州","丹东","太仓","曲靖","烟台","福州","瓦房店","即墨","抚顺","玉溪","张家口","阳泉","莱州","湖州","汕头","昆山","宁波","湛江","揭阳","荣成","连云港","葫芦岛","常熟","东莞","河源","淮安","泰州","南宁","营口","惠州","江阴","蓬莱","韶关","嘉峪关","广州","延安","太原","清远","中山","昆明","寿光","盘锦","长治","深圳","珠海","宿迁","咸阳","铜川","平度","佛山","海口","江门","章丘","肇庆","大连","临汾","吴江","石嘴山","沈阳","苏州","茂名","嘉兴","长春","胶州","银川","张家港","三门峡","锦州","南昌","柳州","三亚","自贡","吉林","阳江","泸州","西宁","宜宾","呼和浩特","成都","大同","镇江","桂林","张家界","宜兴","北海","西安","金坛","东营","牡丹江","遵义","绍兴","扬州","常州","潍坊","重庆","台州","南京","滨州","贵阳","无锡","本溪","克拉玛依","渭南","马鞍山","宝鸡","焦作","句容","北京","徐州","衡水","包头","绵阳","乌鲁木齐","枣庄","杭州","淄博","鞍山","溧阳","库尔勒","安阳","开封","济南","德阳","温州","九江","邯郸","临安","兰州","沧州","临沂","南充","天津","富阳","泰安","诸暨","郑州","哈尔滨","聊城","芜湖","唐山","平顶山","邢台","德州","济宁","荆州","宜昌","义乌","丽水","洛阳","秦皇岛","株洲","石家庄","莱芜","常德","保定","湘潭","金华","岳阳","长沙","衢州","廊坊","菏泽","合肥","武汉","大庆","淮南","滁州","香港","澳门","台北","草场门","中华门","瑞金路","玄武湖","山西路","迈皋桥","仙林大学城","奥体中心","浦口","江宁彩虹桥","高淳淳溪","六合雄州","溧水永阳"];
	var SHCitys=['北京','上海','天津','重庆','哈尔滨','长春','沈阳','呼和浩特','石家庄','乌鲁木齐','兰州','西宁','西安','银川','郑州','济南','太原','合肥','武汉','长沙','南京','成都','贵阳','昆明','南宁','拉萨','杭州','南昌','广州','福州','海口','深圳','台北','香港','澳门'];
	var JSCitys  = ['盐城','南通','扬州','泰州','镇江','宿迁','苏州','淮安','常州','连云港','无锡','南京','徐州'];
	var CSJCitys = ['上海','杭州','宁波','绍兴','湖州','嘉兴','舟山','台州','合肥','马鞍山','金华','衢州','芜湖','滁州','淮南','丽水','温州','盐城','南通','扬州','泰州','镇江','宿迁','苏州','淮安','常州','连云港','无锡','南京','徐州'];
	var NJCitys=['南京','草场门','中华门','瑞金路','玄武湖','山西路','迈皋桥','仙林大学城','奥体中心','浦口','江宁彩虹桥','高淳淳溪','六合雄州','溧水永阳'];
	var __cache__={};
	var AllAQIs={},BMapExt,map,container;
	(function () {
    require.config({
        paths: {
            echarts: './assets/echart',
            d3:'./assets/js/d3.v3.min',
            gauge:'./assets/js/gauge',
            jquery:'./assets/js/jquery'
        },
        packages: [
            {
                name: 'BMap',
                location: './assets/bmap',
                main: 'main'
            }
        ]
    });
    require(['gauge'],function(gauge){
        __gauge=gauge;
        var _currentYear=currentYear,
            _currentMonth=currentMonth;
        //小于半个月默认为上一个月：TODO改为数据判断，如果无数据则为上一个月
        //if(currentDay<15) _currentMonth-=1;
        if(_currentMonth==0){
          _currentMonth=12;
          _currentYear-=1;
        }else if(_currentMonth==-1){
          _currentMonth=11;
          _currentYear-=1;
        }
        setYlvChart(_currentYear+'-'+paddingZero(_currentMonth));
    });
    return;
    require(
    [
        'echarts',
        'BMap',
        'echarts/chart/map'
    ],
    function (echarts, BMapExtension) {
        // 初始化地图
        BMapExt = new BMapExtension($('#allmap')[0], BMap, echarts,{
            enableMapClick: false
        });
        setChartOpts();
        
        // 省内城市
        getJSONData(host+"/map",function(data){
            if(data.Error==null){
            data.Data.forEach(function(e){
                AllAQIs[RMS(e.name)]=parseInt(e.aqi);
            });
            }
            // 南京监测点
            getJSONData(host+"/data?act=aqiarean",function(data){
            if(data.Error==null){
                var d=data.Data;
                for(var i in d){
                if(d[i].name=='市区'){
                    AllAQIs['南京']=d[i].aqi;
                }else{
                    AllAQIs[d[i].name]=d[i].aqi;
                }
                }
            }
            // initChart(0);
            initPoints();
            });
        });
    	});
	})();
function getCitys(type){
  __type=type;
	if(type<=7){
		return AllCitys
	}else{
		return [].concat(NJCitys,AllCitys)
	}
}
function getAQI(aqi){
	var num=parseInt(aqi);
	if(isNaN(num)) return null;
	return num
}

function setChartOpts(){
        map = BMapExt.getMap();
        container = BMapExt.getEchartsContainer();
        map.centerAndZoom(new BMap.Point(118.78,32.04), 5);
        map.enableScrollWheelZoom(false);
        // 地图自定义样式
        map.setMapStyle(mapstyle.blue);
        map.addEventListener("click", function(){
          var that=this;
          setTimeout(function(){
            var zoom=that.getZoom();
            showCMView(zoom);
          },300);
        });
        // 
        // window.onresize = myChart.onresize;
        setInterval(function(){
            var zoom=map.getZoom();
            if(__cache__.type!=zoom){
                showCMView(zoom);
                __cache__.type=zoom;
            } 
        },1000);
	}
    
  function showCMView(zoom){
      if(zoom<6){
            if(myChart){
               myChart.clear();
                myChart.refresh();
                myChart = null; 
            }
            initPoints();
        }else{
            heatmapOverlay.hide();
            myChart = BMapExt.initECharts(container);
            initChart(zoom);
        }
  }
  function initChart(type,zoom){
      var type=type!=null?type:__cache__.type;
	var citys=getCitys(type);
	__cache__.type=type;
	var data=[];
	citys.forEach(function(e){
		data.push({name:e,value:getAQI(AllAQIs[e])});
	});
    var showcitys=type==6||type==8||type<6?[{name:'北京',value:0},{name:'南京',value:0}]:[];
	var option = {
      color: ['gold','aqua','lime'],
      title : {
      		show:false
      },
      tooltip : {
          trigger: 'item',
          formatter: function (v) {
              return v[1]+':'+v[2];
          },
          textStyle:{
          	fontSize:10
          }
      },
      legend: {
          data:['全国'],
          show:false
      },
      toolbox: {
          show : false
      },
      dataRange: {
          min : 0,
          max : 300,
          range: {
              start: 0,
              end: 100
          },
          x: 'right',
          y:'bottom',
          calculable : true,
          color: ['#8F1531', '#CE222F', '#FA3F00','#FF9E00','#EED800','#29C500'],
          textStyle:{
              color:'#fff'
          }
      },
      series : [
          {
              name:'全国',
              type:'map',
              mapType: 'none',
              data:[],
              geoCoord: geoCoordMap
          },
          {
          	name: 'point',
            type: 'map',
            mapType: 'none',
            data:[],
          	markPoint : {
              symbolSize: 5,       // 标注大小，半宽（半径）参数，当图形为方向或菱形则总宽度为symbolSize * 2
              itemStyle: {
                normal: {
                  borderWidth: 1,            // 标注边线线宽，单位px，默认为1
                  label: {
                    show: type==6||type==8||type<6?false:true,
                    textStyle:{
                    	align:'left',
                    	baseline:'middle',
                    	fontSize:8
                    },
                    formatter:function(v){
                    	if(zoom>5||type>0){
                    		return '  '+v.name+': '+v.value
                    	}
                    	return '  '//+v.name
                    }
                  }
                },
                emphasis: {
                  borderColor: '#1e90ff',
                  borderWidth: 5,
                  label: {
                    show: false
                  }
                }
              },
              data:data
          	}
          }
          ,{  
            name: 'point',
            type: 'map',
            mapType: 'none',
            data:[],
            markPoint:{
            symbolSize:0.1,
            itemStyle:{
                normal:{
                    label:{
                        show:type==6||type==8||type<6?true:false,
                        textStyle:{
                            align:'left',
                            baseline:'middle',
                            fontSize:8
                        },
                        formatter:function(v){
                            return '  '+v.name
                        }
                    }
                }
            },
            data:showcitys
            }
          }
	    ]
	  };
    BMapExt.setOption(option);
    myChart.refresh();
  }
  heatmapOverlay = new BMapLib.HeatmapOverlay({
      'radius':20
    //   ,'gradient':{
    //       0.16: "RGBA(2, 227, 0, 1.00)", 
    //       0.33: "RGBA(254, 255, 0, 1.00)", 
    //       0.5: "RGBA(255, 126, 0, 1.00)", 
    //       0.66: "RGBA(254, 0, 0, 1.00)", 
    //       0.99: "RGBA(152, 0, 75, 1.00)", 
    //       1.0: "RGBA(126, 1, 35, 1.00)"
    //   }
    });
  function initPoints(){
    var points=[],data=[];
    for(var i in AllAQIs){
      if(geoCoordMap[i]!=undefined){
        points.push({'name':i,'lng':geoCoordMap[i][0],'lat':geoCoordMap[i][1],'count':AllAQIs[i]});
        // data.push([geoCoordMap[i][0],geoCoordMap[i][1],AllAQIs[i]]);
      }
    }
    
    map.addOverlay(heatmapOverlay);
    heatmapOverlay.setDataSet({data:points,max:300});
    heatmapOverlay.show();
  }
</script>
<script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan style='display:none;' id='cnzz_stat_icon_1259663969'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s4.cnzz.com/z_stat.php%3Fid%3D1259663969' type='text/javascript'%3E%3C/script%3E"));</script>
</html>